package com.lemon.exam.common.exception;

import com.lemon.exam.common.enums.CodeEnum;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 自定义异常
 *
 * @author Lemon
 * @since 2025/2/17 16:16
 */
@Getter
@NoArgsConstructor
public class CustomException extends RuntimeException {
    //响应码
    private Integer code;

    public CustomException(String message) {
        super(message);
    }

    public CustomException(int code, String message) {
        super(message);
        this.code = code;
    }

    public CustomException(CodeEnum codeEnum) {
        super(codeEnum.getMessage());
        this.code = codeEnum.getCode();
    }
}
